﻿@using Gurux.DLMS.AMI.Shared
@using Gurux.DLMS.AMI.Shared.DTOs
@using Gurux.DLMS.AMI.Shared.Rest
@inject HttpClient Http
@inherits ErrorBoundary
@ChildContent

@code
{
    protected override async Task OnErrorAsync(Exception exception)
    {
        try
        {
            GXUserError ue = new GXUserError(System.Diagnostics.TraceLevel.Error);
            ue.Message = exception.Message;
            ue.StackTrace = exception.StackTrace;
            AddUserError req = new AddUserError();
            req.Errors = new GXUserError[] { ue };
            await Http.PostAsJson<AddUserErrorResponse>("api/UserError/Add", req);
        }
        catch (Exception ex)
        {
            //It's OK if this fails.
        }
        await base.OnErrorAsync(exception);
    }

    public new void Recover()
    {
        base.Recover();
    }
}